package com.jsgt.greekfire.ui.mine.user.address.adapter

import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jsgt.greekfire.R
import com.jsgt.greekfire.dao.model.ContactAddress

/**
 * 地址簿适配器
 * author fhx
 * create time 2020/4/23 13:27
 **/
class AddressAdapter : BaseQuickAdapter<ContactAddress, BaseViewHolder>(R.layout.item_address) {

    override fun convert(holder: BaseViewHolder, item: ContactAddress) {
        holder.setText(R.id.txvDesc, item.description)
            .setText(R.id.txvName, item.name)
            .setText(R.id.txvAddress, item.address)
        holder.getView<View>(R.id.txvDesc).visibility = if (item.description.isNullOrEmpty()) {
            View.GONE
        } else {
            View.VISIBLE
        }
    }
}